<template>
	<view class="content">
		<!-- 病案申请邮寄记录applicationRecord -->
		<view class="time">
			<view class="time-left"><text>近一年</text></view>
			<view class="time-right">
				<picker
					mode="date"
					value="{{date}}"
					start="2015-09-01"
					end="2017-09-01"
					bindchange="bindDateChange"
				>
					<view class="picker"><text>选择时间 ▼</text></view>
				</picker>
			</view>
		</view>
		<view
			class="card"
			v-for="item in applicationList"
			:key="item.id"
			@click="go"
		>
			<view class="card-left">
				<view class="top">
					<text>{{ item.mailingName}}</text>
					<text class="top-right">{{item.hospitalNumber}}</text>
				</view>
				<view class="bottom">
					<text>申请日期{{ item.applicationDate}}</text>
				</view>
			</view>
			<view class="card-right">
				<text v-if="item.dischargeStatus==3" style="color:#2ed477 ;"></text>
				
				<text v-else-if="item.dischargeStatus==0" style="color:#ff9138">已寄出</text>
				<text v-else-if="item.dischargeStatus==1" style="color:#cdcdcd">已取消</text>
				<text v-else="item.dischargeStatus==2" style="color:#cdcdcd">已解决</text>
				
			</view>
		</view>
	</view>
</template>

<script setup>
import { onMounted, reactive,ref } from 'vue'
	import {applicationRecordApi} from '@/api/nucleicAcidApi.js'
	import { useLoginStore } from '@/store/loginStore.js'
let applicationList = reactive([])
const loginStore = useLoginStore()
let go = () => {
	uni.navigateTo({
		url: '/pages/allRecord/applicationDetail/applicationDetail'
	})
}
// 传递值


let accountId=1
// accountId=loginStore.id
let startDate='2022-01-01'
let endDate='2022-12-31'

// onMounted(()=>{
// 	applicationRecordApi(accountId,startDate,endDate).then((res)=>{
// 		console.log('办理寄送',res)
// 	})
// })
onMounted(async () => {
	let res = await applicationRecordApi({accountId,startDate,endDate})
	console.log(res)
	// console.log(useTopStore)
	// console.log(accountId,startDate,endDate)
	if (res.data.code == 0) {
		console.log('成功！')
		// console.log(12, res.data.data.list)
		// encyclopediaList.push(...res.data.data.list)
		applicationList.push(...res.data.data)
	}
})
</script>

<style lang="less">
.content {
	font-size: 28rpx;
	margin: 50rpx 30rpx;
	.time {
		display: flex;
		margin-bottom: 30rpx;
		.time-left {
			background-color: #006eff;
			width: 130rpx;
			height: 50rpx;
			line-height: 50rpx;
			color: #ffffff;
			font-size: 25rpx;
			text-align: center;
			border-radius: 50rpx;
		}
		.time-right {
			margin: 0 40rpx;
			background-color: #e4f0ff;
			width: 180rpx;
			height: 50rpx;
			line-height: 50rpx;
			color: #006eff;
			font-size: 25rpx;
			text-align: center;
			border-radius: 50rpx;
		}
	}
	.card {
		// margin: 30rpx 0;
		height: 140rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		border-top: 1px solid #e4f0ff;
		border-bottom: 1px solid #e4f0ff;
		.card-left {
			.top {
				.top-right {
					margin-left: 30rpx;
					font-size: 30rpx;
				}
			}
			.bottom {
				margin-top: 20rpx;
				font-size: 25rpx;
				color: #aaaaaa;
			}
		}
		.card-right {
			font-size: 30rpx;
		}
	}
}
</style>
